package com.example.guiguihomemedical.controller;

import com.example.guiguihomemedical.common.Result;
import com.example.guiguihomemedical.entity.Servicesigning;
import com.example.guiguihomemedical.entity.Signing;
import com.example.guiguihomemedical.entity.Userclassification;
import com.example.guiguihomemedical.service.ServicesigningService;
import com.example.guiguihomemedical.service.UserclassificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("userclassification")
public class UserclassificationController {
    @Autowired
    private UserclassificationService userclassificationService;
    @GetMapping
    public Result getAll(){
        List<Userclassification> userclassificationList = userclassificationService.getAll();
        return Result.success(userclassificationList);
    }
    @DeleteMapping("/{idcard},{peopleid}")
    public Result delete(@PathVariable String idcard,@PathVariable Integer peopleid){
        userclassificationService.delete(idcard,peopleid);
        return Result.success();
    }

    @PostMapping
    public Result add(@RequestBody Userclassification userclassification){
        userclassificationService.add(userclassification);
        return Result.success();
    }

    @GetMapping("/{idcard}")
    public Result getByIdcard(@PathVariable String idcard){
        List<Userclassification> userclassification = userclassificationService.getByIdcard(idcard);
        return Result.success(userclassification);
    }
}
